package xyz.quanguanjia.masterboy.me;

import android.content.Intent;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

import xyz.quanguanjia.masterboy.MBDApplication;
import xyz.quanguanjia.masterboy.MBDLookAdActivity;
import xyz.quanguanjia.masterboy.MBDPersonalInfoActivity;
import xyz.quanguanjia.masterboy.MBDToolbarUtils;
import xyz.quanguanjia.masterboy.MBDUploadGroupActivity;
import xyz.quanguanjia.masterboy.R;
import xyz.quanguanjia.masterboy.adapter.MBDEarnIntegrateAdapter;

public class MBDEarnIntegrateActivity extends AppCompatActivity {
    private RecyclerView recyclerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_earn_integrate);

        recyclerView = findViewById(R.id.recyclerView);

        Toolbar toolbar = findViewById(R.id.toolbar);
        MBDToolbarUtils.setCenterTitle(toolbar, "赚积分");

        MBDToolbarUtils.backButtonClicked(toolbar, new Runnable() {
            @Override
            public void run() {
                finish();
            }
        });

        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.addItemDecoration(new DividerItemDecoration(MBDApplication.getContext(), LinearLayoutManager.VERTICAL));

        List<String> earnIntegrationWays = new ArrayList<>();
        earnIntegrationWays.add("完善个人信息");
        earnIntegrationWays.add("发布新群");
        earnIntegrationWays.add("看广告");

        MBDEarnIntegrateAdapter adapter = new MBDEarnIntegrateAdapter(this, earnIntegrationWays, new MBDEarnIntegrateAdapter.OnEarnIntegrationClickListener() {
            @Override
            public void onEarnIntegrationClick(int position) {
                // 处理点击事件，跳转到相应的 Activity
                Intent intent;
                switch (position) {
                    case 0:
                        intent = new Intent(MBDEarnIntegrateActivity.this, MBDPersonalInfoActivity.class);
                        break;
                    case 1:
                        intent = new Intent(MBDEarnIntegrateActivity.this, MBDUploadGroupActivity.class);
                        break;
                    case 2:
                        intent = new Intent(MBDEarnIntegrateActivity.this, MBDLookAdActivity.class);
                        break;
                    default:
                        return;
                }
                startActivity(intent);
            }
        });

        recyclerView.setAdapter(adapter);


    }

}
